Resource id #110
select count(*) from Agenda a         left join POPs c on a.pPOP = c.pPId and c.iVer = c.iVAt         left join OOp e on a.pOOp = e.pPId and e.iVer = e.iVAt  where a.iVer = a.iVAt   and a.lExc = 0   and (a.pUsu = 3979 or e.pUsu = 3979)  and (c.pPId is null or ((c.pPId is not null) and (c.lExc=0 or a.tExec is not null or a.tNExec is not null)))  and ((a.tQdo >= '2025/07/22' || ' 00:00:00' and a.tQdo <= '2025/07/22' || ' 23:59:59') or a.tQdo is null)